{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cross-station",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/goat-latin\n",
    "\n",
    "\n",
    "Runtime: 0 ms, faster than 100.00% of C++ online submissions for Goat Latin.\n",
    "Memory Usage: 6.5 MB, less than 70.69% of C++ online submissions for Goat Latin.\n",
    "\n",
    "\n",
    "```cpp\n",
    "#include <vector>\n",
    "#include <algorithm>\n",
    "#include <iostream>\n",
    "#include <set>\n",
    "#include <bits/stdc++.h> \n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    string toGoatLatin(string S) {\n",
    "        //3:00\n",
    "        vector<char> vowel = {'a', 'e', 'i', 'o', 'u'}; \n",
    "\n",
    "        string result;\n",
    "\n",
    "        stringstream s_strem(S); \n",
    "        string word; \n",
    "        int i=1;\n",
    "        while(getline(s_strem, word, ' ')) \n",
    "        { \n",
    "            auto first_char = word[0];\n",
    "            if (find(vowel.begin(), vowel.end(), tolower(first_char)) != vowel.end()) {\n",
    "                word = word + \"ma\";\n",
    "            } else {\n",
    "                word = word.substr(1, word.size()-1) + word.substr(0, 1) + \"ma\"; \n",
    "            }\n",
    "\n",
    "            for(int n=0; n<i ;n++) {\n",
    "                word += \"a\";\n",
    "            }\n",
    "\n",
    "            result += word + \" \";\n",
    "            i++;\n",
    "        } \n",
    "        return result.substr(0, result.size()-1);\n",
    "        //3:12\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "valuable-suggestion",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
